package com.itheima.user.clients;

import com.itheima.common.vo.OrderVO;
import com.itheima.user.clients.fallback.OrderClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "order-server",fallback = OrderClientFallback.class)//声明feign的客户端,并配置服务名称
public interface OrderClient {

    /**
     * 对外提供接口,以便服务内部之间进行调用.
     * @param username 用户名
     * @return 根据用户名查询到的订单对象
     */
    @GetMapping("/order/query")
    List<OrderVO> findOrderByUsername(@RequestParam("username") String username);
}
